package com.map.test;

import com.map.model.StudentModel;

/**
 * @author Li
 * @Date 2023/4/14 9:46
 */
public class ObjectArray {
    public static void main(String[] args) {
        StudentModel[] studentModels = new StudentModel[2];
        String zhangsan = "张三,23";
        String[] zhangsans = zhangsan.split(",");
        StudentModel studentModel = new StudentModel();
        studentModel.setName(zhangsans[0]);
        studentModel.setAge(Integer.valueOf(zhangsans[1]));
        studentModels[0] = studentModel;

        String lisi = "李四,24";
        String[] lisis = lisi.split(",");
        StudentModel studentModel1 = new StudentModel();
        studentModel1.setName(lisis[0]);
        studentModel1.setAge(Integer.valueOf(lisis[1]));
        studentModels[1] = studentModel1;

        for (int i = 0; i < studentModels.length; i++) {
            System.out.println(studentModels[i]);
        }
    }
}
